/*
 * Table.java  0.4.0 / Oct 27, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing;

import com.cute4j.swing.table.DefaultTableModel;
import com.cute4j.swing.table.TableModel;

/**
 * Table Component.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class Table extends Component {

  // TODO: finish

// Static Initialization. ------------------------------------------------------

  static {
    _initialize();
  }

// Protected Fields. -----------------------------------------------------------

  protected TableModel dataModel;

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new Table object.
   */
  public Table() {
    this(new DefaultTableModel());
  }

  /**
   * Constructs new Table object.
   *
   * @param data the data
   * @param columnNames the column names
   */
  public Table(Object[][] data, Object[] columnNames) {
    this(new DefaultTableModel(data, columnNames));
  }

  /**
   * Constructs new Table object.
   *
   * @param model the table model
   */
  public Table(TableModel model) { // NOPMD - temp
    super(false); // TODO: remove
    throw new RuntimeException("Not implemented");  // TODO: implement, NOPMD
    /*if (model == null) {
      // TODO: model = createDefaultDataModel()
      throw new IllegalArgumentException("Null model");
    }
    dataModel = model;*/
  }

// Public Methods. -------------------------------------------------------------

  /**
   * Sets table model.
   *
   * @param model the table model
   */
  public void setModel(TableModel model) {
    if (model == null) {
      // TODO:  model = createDefaultDataModel()
      throw new IllegalArgumentException("Null model");
    }
    dataModel = model;
  }

// Package-Private Native Methods. ---------------------------------------------

  native long _create();

  native void _setModel(long delegate, TableModel model);

// Private Static Native Methods. ----------------------------------------------

  private static native void _initialize();

}
